<?php
  /**
  Author: shielamarie
  Date: Nov 2011
  **/
	class SchoolController
	{
		private $d;

		const PRE_ELEMENTARY = 1;
		const ELEMENTARY = 2;

		public function __construct()
		{
			$this->d = new DbHelper();
		}
		public function getStudentCount($departmentId) {
		  $query = "SELECT COUNT(*) FROM Students
		            WHERE DepartmentId = '$departmentId'";
		  return mysql_result($this->d->query($query),0);
		}
		public function getDepartmentList()
		{
		  $query = "SELECT * FROM Departments";
		  return $this->d->query($query);
		}
		public function getReceivablesByDepartment($id)
		{
		  $query = "SELECT Students.DepartmentId, Students.GradeLevel,YearLevels.YearLevelDescription,Students.TotalFees
		            FROM Students
		            INNER JOIN YearLevels
		            ON Students.GradeLevel = YearLevels.YearLevelId
		            WHERE Students.DepartmentId = '$id'";
		  return $this->d->query($query);
		}
	}
?>